package net.neiquan.applibrary.utils;

import android.app.Activity;
import android.graphics.Point;
import android.graphics.Rect;
import android.view.View;

/**
 * Author:Dandy
 * Date:2016/11/18
 */

public class JudgeViewInWindow {
    public static boolean isViewInWindow(Activity ac, View view) {
        Point p = new Point();
        ac.getWindowManager().getDefaultDisplay().getSize(p);
        int screenWidth = p.x;
        int screenHeight = p.y;
        Rect rect = new Rect(0, 0, screenWidth, screenHeight);
        if (view.getLocalVisibleRect(rect)) {
            return true;
        } else {
            return false;
        }
    }
}
